<template>
  <!-- <button v-for="(item, index) in demos" :key="index" @click.stoo="gotoPage(item)">{{ item.label }}</button> -->
  <uni-file-picker :auto-upload="false" ref="uploadRef" v-model="fileList" @success="successHandler" @fail="failHandler" :sourceType='["camera"]'></uni-file-picker>
  
  <view v-for="(file, index) in fileList" :key="index" style="border: 1px solid red;padding: 10px;overflow: auto;">
    {{JSON.stringify(file)}}
  </view>
  
  <button @click="clearHandler">clear</button>
  <button @click="uploadHandler">upload</button>
  <button @click="print">print</button>

  <!-- <l-signature landscape></l-signature> -->


  <view style="margin: 20px 0; border: 1px solid #eee; padding: 10px;">
    <x-sign
      :width="300"
      :height="150"
    />
  </view>
</template>
<script setup lang="ts">
declare const uni: any
import {getCurrentInstance, ref} from "vue"
import xSign from '@/components/x-sign/x-sign.vue'

const vm = getCurrentInstance()

  const demos = [
    {
      url:'/components/x-notification/demo',
      label: '顶部滚动通知'
    }
  ]

  function gotoPage(item) {
    uni.navigateTo({
      url: item.url
    })
  }
  
  const uploadRef = ref()
  
  const fileList  = ref([])
  
  const clearHandler = () => {
    uploadRef.value?.clearFiles()
  }
  
  const uploadHandler = () => {
    uploadRef.value?.upload()
  }
  
  const successHandler = (e) => {
    console.log('succ', e);
  }
  
  const failHandler = (e) => {
    console.log('fail', e);
  }
  
  const print = () => {
    console.log('time', new Date());
  }
  
  

  
</script>
